// const SERVER_URL = 'http://10.0.3.2:8080';
// const SERVER_URL = 'http://benefitbridge.cn:8080';

const ORGANIZATIONS = [
  {name: '山东海事局', value: '/shandong', active: true},
  {name: '滨州海事局', value: '/binzhou', active: true},
  {name: '董家口海事局', value: '/dongjiakou', active: true},
  {name: '东营海事局', value: '/dongying', active: true},
  {name: '济南海事局', value: '/jinan', active: true},
  {name: '青岛海事局', value: '/qingdao', active: true},
  {name: '日照海事局', value: '/rizhao', active: true},
  {name: '威海海事局', value: '/weihai', active: true},
  {name: '潍坊海事局', value: '/weifang', active: true},
  {name: '烟台海事局', value: '/api', active: true}
]

const MAP_ATTR = 'Map data &copy; 国交信通 contributors'

const DEPT_OBJECT = {
  // 山东海事局辖区
  '/shandong': [
    {
      name: '济南海事局',
      // pos: [38.4, 118.1],
      points: [
        [38.264167, 117.845833],
        [38.374444, 118.005278],
        [38.390833, 118.178333],
        [38.5075, 118.591389],
        [38.507222, 118.662778],
        [38.5, 119.583333]
        // [38.3, 117.9],
        // [38.3, 119.583333],
        // [37.133333, 119.583333]
      ]
    },
    {
      name: '烟台海事局',
      pos: [38.2, 120.7],
      points: [
        [37.133333, 119.583333],
        [38.5, 119.583333],
        // [38.3, 119.583333],
        // [38.3, 120.333333],
        // [38.5, 120.333333],
        [38.5, 121.918986],
        [37.468383, 121.918986]
      ]
    },
    {
      name: '烟台海事局',
      points: [
        [36.781628, 121.468378],
        [36.781672, 121.471736],
        [36.760681, 121.475097],
        [36.743306, 121.460486],
        [36.323703, 121.572217],
        [36.212867, 121.393661],
        [36.530483, 121.047956]
      ]
    },
    {
      name: '威海海事局',
      pos: [38, 122.2],
      points: [
        [37.468383, 121.918986],
        [38.5, 121.918986],
        [38.5, 123]
      ]
    },
    {
      name: '威海海事局',
      points: [
        [36.781628, 121.468378],
        [36.781672, 121.471736],
        [36.760681, 121.475097],
        [36.743306, 121.460486],
        [36.566667, 121.507597],
        [36.566667, 123]
      ]
    },
    {
      name: '青岛海事局',
      pos: [36.2, 121.5],
      points: [
        [36.530483, 121.047956],
        [36.212867, 121.393661],
        [36.323703, 121.572217],
        [36.566667, 121.507597],
        [36.566667, 123]
      ]
    },
    {
      name: '青岛海事局',
      points: [
        [35.726389, 119.945833],
        [35.641111, 120.0325],
        [35.641111, 123]
      ]
    },
    {
      name: '日照海事局',
      pos: [35.3, 121.5],
      points: [
        [35.086111, 119.3],
        [35.141292, 119.914378],
        [35.141292, 123]
      ]
    },
    {
      name: '董家口海事局',
      // pos: [],
      // points: [
      //   [35.726388, 119.945833],
      //   [35.641111, 120.0325],
      //   [35.641111, 123]
      // ]
    },
    {
      name: '董家口海事局',
      pos: [35.6, 121.5],
      points: [
        [35.593818, 119.637545],
        [35.585761, 119.659851],
        [35.568644, 119.697747],
        [35.453203, 119.843789],
        [35.453203, 123]
      ]
    },
    {
      name: '潍坊海事局',
      pos: [37.3, 119.0],
      points: [
        [37.296389, 118.882778],
        [37.360278, 119.183333],
        [37.414722, 119.247778],
        [37.414722, 119.372222],
        [37.549722, 119.583333],
        [37.133333, 119.583333]
      ]
    },
    {
      name: '东营海事局',
      pos: [38.2, 118.8]
      //points: [
      // [38.507222, 118.662778],
      // [38.408333, 118.662778],
      // [38.269444, 118.263056],
      // [38.119167, 118.250278]
      //]
    },
    {
      name: '滨州海事局',
      pos: [38.3, 118.0],
      points: [
        [38.507222, 118.662778],
        [38.408333, 118.662778],
        [38.269444, 118.263056],
        [38.119167, 118.250278]
      ]
    }
  ],
  // 烟台海事局各海事处海域管辖范围
  '/api': [
    {
      name: '莱州海事处',
      // labelPosition: [],
      points: [
        [37.1333, 119.5833],
        [38.3, 119.5833],
        [38.3, 120],
        [37.6833, 120],
        [37.4733, 120.1433]
      ]
    },
    {
      name: '龙口海事处',
      // labelPosition: [],
      points: [
        [38.3, 119.5833],
        [38.5033, 119.5833],
        [38.5, 120.4666],
        [37.9, 120.4666],
        [37.7458, 120.4666]
      ]
    },
    {
      name: '蓬莱海事处',
      // labelPosition: [],
      points: [
        [37.7458, 120.4666],
        [37.9, 120.4666],
        [37.9, 120.6],
        [37.88, 120.69],
        [37.8708, 120.7322],
        [37.8708, 120.9583],
        [37.7652, 120.9583]
      ]
    },
    {
      name: '长岛海事处',
      // labelPosition: [],
      points: [
        [37.8708, 120.9583],
        [38.5, 120.9583],
        [38.5, 120.4666]
      ]
    },
    {
      name: '芝罘海事处',
      // labelPosition: [],
      points: [
        [38.5, 120.9583],
        [38.5, 121.9189],
        [37.5561, 121.9189],
        [37.5561, 121.54],
        [37.4652, 121.4777]
      ]
    },
    {
      name: '牟平海事处',
      // labelPosition: [],
      points: [
        [37.5561, 121.9189],
        [37.4683, 121.9189]
      ]
    },
    {
      name: '海阳海事处',
      // labelPosition: [],
      points: [
        [36.7816, 121.4683],
        [36.7816, 121.4717],
        [36.7606, 121.4750],
        [36.7433, 121.4604],
        [36.3237, 121.5722],
        [36.2128, 121.3936],
        [36.5304, 121.0146]
      ]
    },
    {
      name: '八角海事处',
      // labelPosition: [],
      points: [
        [37.7653, 120.9583],
        [37.8708, 120.9583],
        [38.5, 120.9583],
        [38.5, 121.3833],
        [37.8, 121.3833],
        [37.8, 121.3033],
        [37.5783, 121.3033]
      ]
    }
  ]
}

function getAreaByOrg() {
  let key = window.apiPath
  return DEPT_OBJECT[key] || []
}

let IP = ''
if (window.location.href.indexOf('198.') > -1) {
// if (window.location.href.indexOf('local') > -1) {
  IP = '198.15.20.52'
} else {
  IP = '218.58.72.201'
}

const ConfigData = {
  // SERVER_URL: 'http://192.168.0.11:8080',
  SERVER_URL: '',
  FILE_UPLOAD_URL: '/api/importexcel',
// const SERVER_URL = __DEV__ ? 'http://192.168.0.6:8080' : 'http://benefitbridge.cn:8080';
  PAGE_SIZE: 10,

  // 海图相关，海图瓦片
  // OSM_URL: 'http://218.58.72.201:8019/{z}/{x}/{y}?dc=3', //外网测试地址,外网部署的最权威地址
  OSM_URL: 'http://' + IP + ':8019/{z}/{x}/{y}?dc=3', // 服务器上正式地址
  OSM_OPTION: {
    minZoom: 0,
    maxZoom: 18,
    zIndex: 1,
    attribution: MAP_ATTR
  },
  // 船位分布图相关
  SHIP_URL: 'http://' + IP + ':8080/{z}/{x}/{y}', // 服务器上正式地址
  SHIP_OPTION: {
    minZoom: 0,
    maxZoom: 10,
    zIndex: 4
  },
  // 船舶实时位置图相关
  SHIP_BOUNDS_URL: 'http://' + IP + ':8080/bounds', // demo中地址
  MINI_OPTION: {
    minZoom: 3,
    maxZoom: 13,
    attribution: MAP_ATTR
  },
  SHIP_COLOR_ARRAY: [
    {name: '客船类', code: '01', color: '#3526F7', typeArray: ['普通客船', '客货船', '客渡船', '车客渡船', '旅游客船', '高速客船', '客驳船', '滚装客船', '客箱船', '火车渡船（客）', '地效翼船', '高速客滚船']},
    {name: '普通货船类', code: '02', color: '#21F55F', typeArray: ['干货船', '杂货船', '散货船', '散装水泥运输船', '集装箱船', '滚装船', '多用途船', '木材船', '水产品运输船', '重大件运输船', '驳船', '汽车渡船', '挂桨机船', '冷藏船', '火车渡船', '矿/散/油船', '半潜船']},
    {name: '液货船类', code: '03', color: '#EF262E', typeArray: ['油船', '散装化学品船', '散装化学品船/油船', '液化气船', '散装沥青船', '油驳', '一般液货船']},
    {name: '工程船类', code: '04', color: '#F4E732', typeArray: ['工程船', '测量船', '采沙船', '挖泥船', '疏浚船', '打捞船', '打桩船', '起重船', '搅拌船', '布缆船', '钻井船', '打桩起重船', '吹泥船', '起重驳']},
    {name: '工作船类', code: '05', color: '#c0c0c0', typeArray: ['工作船', '破冰船', '航标船', '油污水处理船', '供给船', '垃圾处理船']},
    {name: '拖船类', code: '06', color: '#92CCED', typeArray: ['拖船', '推轮']},
    {name: '其它类', code: '09', color: '#A427EB', typeArray: ['交通艇', '引航船', '救助船', '浮船坞', '公务船', '摩托艇', '帆船', '趸船', '游艇', '特种用途船', '水上平台', '水下观光船', '科学调查船', '勘探船']}
  ],
  SHIP_COLOR_DEFAULT: '#A427EB',
  getManagementArea: getAreaByOrg,
  ORGANIZATIONS
}

export default ConfigData
